﻿using System;

namespace Songhay.Data.Activity
{
    /// <summary>
    /// Defines data procedures.
    /// </summary>
    public interface IDataActivityAssembly
    {
        /// <summary>
        /// Runs the data transformations of this component.
        /// </summary>
        void Execute(DataAccessItem accessItem);

        /// <summary>
        /// All of the runtime messages generated and captured for this class.
        /// </summary>
        string Log
        {
            get;
        }

        /// <summary>
        /// Fires when the writing the latest entry into the transformation log.
        /// </summary>
        event EventHandler<OnWriteLogEventArgs> WriteLog;
    }

    /// <summary>
    /// Event argument for implementing
    /// the <see cref="Songhay.Data.Activity.IDataActivityAssembly.WriteLog"/> event.
    /// </summary>
    public class OnWriteLogEventArgs : System.EventArgs
    {
        /// <summary>
        /// Constructor.
        /// </summary>
        /// <param name="newEntry">
        /// The latest entry into the transformation log.
        /// </param>
        public OnWriteLogEventArgs(string newEntry)
        {
            this._newEntry = newEntry;
        }

        /// <summary>
        /// The latest entry into the transformation log.
        /// </summary>
        public string NewEntry
        {
            get { return this._newEntry; }
        }

        private string _newEntry = String.Empty;
    }
}